#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Python.h"

int fac( int n)
{
	if (n < 2) return (1); /* 0! == 1! == 1 */
	return (n)*fac(n-1); /* n! == n*(n-1)! */
}

static PyObject * Extest_fac(PyObject *self,PyObject *args)
{
	int res;
	int num;
	PyObject* retval;
	res=PyArg_ParseTuple(args,"i",&num);
	if(!res)
	{
		return NULL;
	}
	res=fac(num);
	retval=(PyObject*)Py_BuidlValue("i",res);
	return retval;

}

static PyMethodDef ExtestMethods[] = {
{ "fac", Extest_fac, METH_VARARGS },
{ NULL, NULL },
};

void initExtest() {
Py_InitModule("Extest", ExtestMethods);
}





